<template>
    <div class="mui-numbox" data-numbox-min='1' data-numbox-max='60'>
					<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
                    <!-- 这里的readonly作用是只能读取数据，不动修改 -->
					<input id="test" class="mui-input-numbox"  type="number" :value="init" @change="count"  ref="number" readonly />
					<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
	</div>
</template>

<script>
// 导入mui js，初始化numbox功能
import mui from '../../lib/mui/js/mui.min.js'
export default {
    mounted(){
        mui('.mui-numbox').numbox()
    },
    methods:{
        count(){
            // 数值改变了,则立即把数据传入到购物车的数值中，覆盖之前对数据
            console.log(this.$refs.number.value)
            this.$store.commit("undata",{
                count:this.$refs.number.value
            })
        }
    },
    props:["init"]   
}
</script>

<style scoped>
    
</style>